Refactor desired DNS functions#1
Merged
serbrech merged 3 commits intoserbrech:azure-providerfrom May 29, 2019
Merged
Conversation
Refactor DNS handling to consolidate how the desired set of DNS records is computed. This ensures that the same function can be used for both setting up and tearing down DNS. Add some unit testing around the desired DNS function.
Author
|
DNS successfully syncs with this branch — will fix up the unit test tomorrow. |
Author
|
Latest commit adds unit tests, next up I have to do some e2e testing around delete handling and then I think this is ready. |
Author
|
Okay, I've tested add and delete scenarios with multiple ingress controllers. There's some work to do in the client to clean up how we check for existing DNS records during delete, but we can do that in a followup. |
serbrech
approved these changes
May 29, 2019
| _, err := c.recordSets.Delete(ctx, zone.ResourceGroup, zone.Name, arec.Name, dns.A, "") | ||
| _, err := c.recordSets.Get(ctx, zone.ResourceGroup, zone.Name, arec.Name, dns.A) | ||
| if err != nil { | ||
| // TODO: How do we interpret this as a notfound error? |
Owner
There was a problem hiding this comment.
snippet :
package errors
import (
"github.com/Azure/go-autorest/autorest"
)
func IsNotFound(err error) bool {
if derr, ok := err.(autorest.DetailedError); ok && derr.StatusCode == 404 {
return true
}
return false
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor DNS handling to consolidate how the desired set of DNS records is
computed. This ensures that the same function can be used for both setting up
and tearing down DNS.
Add some unit testing around the desired DNS function.
TODO